using System.ComponentModel;
using System.Reflection;

namespace MVCSpike
{
    public abstract class MvcModelBase : INotifyPropertyChanged
    {
        protected event PropertyChangedEventHandler m_propertyChanged;

        public event PropertyChangedEventHandler PropertyChanged
        {
            add { m_propertyChanged += value; }
            remove { m_propertyChanged -= value; }
        }

        protected void ObjectChanged(MethodBase property)
        {
            if (null != m_propertyChanged)
            {
                string propertyName = property.Name.Replace("set_", "");
                m_propertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
                
        }
    }
}